﻿using AuditSample.Model;
using System;
using System.Activities;
using System.Activities.Tracking;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AuditSample
{
    public class WaitForAuditActivity : NativeActivity<AuditProcess>
    {

        public InArgument<string> BookmarkName { get; set; }
        //public OutArgument<string> CurrentUser { get; set; }
        //public OutArgument<string> Comment { get; set; }
        protected override void Execute(NativeActivityContext context)
        {
            context.CreateBookmark(BookmarkName.Get(context), new BookmarkCallback(OnResumeBookmark));   //创建书签
        }

        protected override bool CanInduceIdle
        {
            get { return true; }
        }

        public void OnResumeBookmark(NativeActivityContext context, Bookmark bookmark, object obj)
        {
            // When the Bookmark is resumed, assign its value to
            // the Result argument.
            //var auditProcess = (AuditProcess)obj;
            //CurrentUser.Set(context, auditProcess.CurrentUser);
            //Comment.Set(context, auditProcess.Comment);
            //Result.Set(context, auditProcess.AuditFlag);
            Result.Set(context, (AuditProcess)obj);
        }
    }
}
